package com.yanqu.road.server.cmd.guess.cross;

import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.pb.activity.CommonGuessProto;
import com.yanqu.road.server.cmd.base.AbstractCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.command.CmdApi;
import com.yanqu.road.server.gameplayer.GamePlayer;
import com.yanqu.road.server.gameplayer.module.guess.CommonGuessModule;
import com.yanqu.road.server.protocol.ClientProtocol;
import com.yanqu.road.server.protocol.Protocol;

@CmdApi(reqMsg = CommonGuessProto.CommonGuessSaveDataFromCrossReqMsg.class, respMsg = CommonGuessProto.CommonGuessSaveDataRespMsg.class)
@Cmd(code = Protocol.S_COMMON_GUESS_SAVE_DATA_FROM_CROSS,desc = "通用竞猜-跨服返回-保存竞猜数据")
public class CommonGuessSaveDataFromCrossCmd extends AbstractCommand {

    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        return true;
    }

    @Override
    public void execute(GamePlayer player, YanQuMessage packet) throws Exception {
        CommonGuessProto.CommonGuessSaveDataFromCrossReqMsg reqMsg = CommonGuessProto.CommonGuessSaveDataFromCrossReqMsg.parseFrom(packet.getBytes());
        //保存选择-跨服返回
        player.getModule(CommonGuessModule.class).saveDataFromCross(reqMsg);
        //回包
        CommonGuessProto.CommonGuessSaveDataRespMsg.Builder respMsg = CommonGuessProto.CommonGuessSaveDataRespMsg.newBuilder();
        respMsg.setRet(0);
        player.sendPacket(ClientProtocol.U_COMMON_GUESS_SAVE_DATA, respMsg);
    }

    @Override
    public void sendData(GamePlayer player) {

    }
}
